<!DOCTYPE html>
<html lang="en">
<head>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>{{title}}</p>
        <my-component></my-component>
    </div>
    <template id="tmp1">
        <p>{{title}}</p>
    </template>
    <script>
        Vue.component('my-component',{
            template:'#tmp1',
            data : function() {
                return {title : '我是组件内的title'}
            }
        });
        var vm = new Vue({
            el:'#app',
            data : {
                title : '我是vm实例中的title'
            }
        });
    </script>
</body>
</html>